package com.test.android.metro;

import com.test.android.metro.model.MetroItem;
import com.test.android.metro.ui.MetroView;
import com.test.android.metro.ui.MetroView.OrientationType;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

public class MetroUIOne extends Activity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.metro_ui);

		MetroView view = (MetroView) findViewById(R.id.metro_ui);

		view.setVisibleItems(0, 3);
		view.setOrientation(OrientationType.All);
		int maxColumn = 8;

		for (int i = 0; i < 80; i++) {
			TextView tv = new TextView(this);
			tv.setText(String.valueOf(i));
			tv.setGravity(Gravity.CENTER);
			tv.setBackgroundColor(Color.GRAY);
			tv.setOnClickListener(new OnClickListener() {
				
				public void onClick(View v) {
					TextView senderTextView  =(TextView) v;
					String outString = (String)senderTextView.getText();
					Log.d("MetroUIOneDebug",outString );
				}
			});
			
			
			int row = i / maxColumn;
			int col = i % maxColumn;

			MetroItem item = new MetroItem(tv, row, col);
			view.addMetroItem(item);
		}
	}
}
